package cn.tedu.health.service.impl;

import cn.tedu.health.mapper.SocialFeaturesMapper;
import cn.tedu.health.pojo.entity.SocialFeatures;
import cn.tedu.health.service.ISocialFeaturesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SocialFeaturesService implements ISocialFeaturesService {

    @Autowired
    private SocialFeaturesMapper socialFeaturesMapper;

    @Override
    public void createSocialFeature(SocialFeatures socialFeatures) {
        socialFeaturesMapper.insert(socialFeatures);
    }

    @Override
    public List<SocialFeatures> getSocialFeaturesByUserId(Long userId) {
        return socialFeaturesMapper.findByUserId(userId);
    }

    @Override
    public List<SocialFeatures> getSocialFeaturesByUserIdAndFriendId(Long userId, Long friendId) {
        Map<String, Object> params = new HashMap<>();
        params.put("userId", userId);
        params.put("friendId", friendId);
        return socialFeaturesMapper.findByUserIdAndFriendId(params);
    }
}
